package mylibrary.serialize.example;

import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;

public class Person implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	public Person(String firstName, String lastName, int age) {
		this.firstName = firstName;
		this.lastName = lastName;
		this.age = age;
	}
	
	public String toString() {
		return "";
	}
	
	private void writeObject(ObjectOutputStream stream) throws IOException {
		age = age + 10;
		stream.defaultWriteObject();
	}
	private void readObject(ObjectInputStream stream) throws Exception {
		stream.defaultReadObject();
		age = age - 10;
	}
	
	private String firstName;
	private String lastName;
	private int age;
	private Person Spouse;
	private String gender;
	public String getFirstName() {
		return firstName;
	}
	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}
	public String getLastName() {
		return lastName;
	}
	public void setLastName(String lastName) {
		this.lastName = lastName;
	}
	public int getAge() {
		return age;
	}
	public void setAge(int age) {
		this.age = age;
	}
	public Person getSpouse() {
		return Spouse;
	}
	public void setSpouse(Person spouse) {
		Spouse = spouse;
	}

	public String getGender() {
		return gender;
	}

	public void setGender(String gender) {
		this.gender = gender;
	}
	
}
